package code.lewdy.app.communication;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

/**
 * 站内信
 * @author liuding,2012-4-20
 *
 * $LastChangedDate$
 * $Author$ 
 */
@Entity
@Table
public class Message
{
	@Transient
	public static final int TYPE_MSG_ONLINE = 0; //站内信
	@Transient
	public static final int TYPE_SYSTEM_ASK = 1; //会员向客服提问
	@Transient
	public static final int TYPE_SYSTEM_ANSWER = 2; //客服回复会员
	@Transient
	public static final int TYPE_SYSTEM_NOTICE = 4; //平台通知，接收者为全体会员
	
    private Long id;
    private Long topId; //上级message ID
    private String title;
    private String content;
    private Long senderId;
    private String senderName;
    private Long receiverId;
    private String receiverName;
    private Date createDate;
    private Date replyDate;
    private int typeId;
    private int isRead; // 是否已读 0-未读
    private int isReply; //0-未回复
    
    @Column(length=1000)
    public String getContent()
    {
        return content;
    }
    public void setContent(String content)
    {
        this.content = content;
    }
    @Temporal(TemporalType.TIMESTAMP)
    public Date getCreateDate()
    {
        return createDate;
    }
    public void setCreateDate(Date createDate)
    {
        this.createDate = createDate;
    }
    @Id
    @GeneratedValue
    public Long getId()
    {
        return id;
    }
    public void setId(Long id)
    {
        this.id = id;
    }
    public Long getReceiverId()
    {
        return receiverId;
    }
    public void setReceiverId(Long receiverId)
    {
        this.receiverId = receiverId;
    }
    public Long getSenderId()
    {
        return senderId;
    }
    public void setSenderId(Long senderId)
    {
        this.senderId = senderId;
    }
    @Column(length=100)
    public String getTitle()
    {
        return title;
    }
    public void setTitle(String title)
    {
        this.title = title;
    }
    public int getTypeId()
    {
        return typeId;
    }
    public void setTypeId(int typeId)
    {
        this.typeId = typeId;
    }
	public void setSenderName(String senderName) {
		this.senderName = senderName;
	}
	@Column(length=30)
	public String getSenderName() {
		return senderName;
	}
	public void setReceiverName(String receiverName) {
		this.receiverName = receiverName;
	}
	@Column(length=30)
	public String getReceiverName() {
		return receiverName;
	}
	public void setTopId(Long topId) {
		this.topId = topId;
	}
	public Long getTopId() {
		if(topId == null){
			topId = 0L;
		}
		return topId;
	}
	public void setIsRead(int isRead) {
		this.isRead = isRead;
	}
	public int getIsRead() {
		return isRead;
	}
	public void setIsReply(int isReply) {
		this.isReply = isReply;
	}
	public int getIsReply() {
		return isReply;
	}
	public void setReplyDate(Date replyDate) {
		this.replyDate = replyDate;
	}
	@Temporal(TemporalType.TIMESTAMP)
	public Date getReplyDate() {
		return replyDate;
	}
}
